怎麼檢查 object 是不是空的?


Posted by Rich on 2021-09-12

有時候會有這種需求,這次解決的幫手是:

let obj = {}
if (Object.keys(obj).length === 0) //true

怕忘記,紀錄一下。










Related Posts

下載react repo 出現npm i 錯誤 > <

下載react repo 出現npm i 錯誤 > <

D22_第三週解題

D22_第三週解題

API 簡介與實戰練習

API 簡介與實戰練習


Comments